#pragma once
#include <iostream>
#include <string>
#include <fstream>

class Util
{
public:
    static std::string parseOneLine(std::string &buffer, const std::string &sep)
    {
        auto pos = buffer.find(sep);
        if(pos == std::string::npos) return "";

        std::string sub = buffer.substr(0, pos);
        // buffer.erase(0, pos + sep.size());
        return sub;
    }

    static bool readFile(const std::string &path, char *out, size_t size)
    {
        //std::ifstream ifs(path);
        std::ifstream ifs(path, std::ifstream::binary);
        if(!ifs.is_open())
        {
            return false;
        }
        // std::string buffer;

        ifs.read(out, size);
        // while(std::getline(ifs, buffer))
        // {
        //     out += buffer;
        // }
        ifs.close();
        return true;
    }

    
};